<template>
  <div id="sysAssetA3" v-loading="page.loading">
    <template v-if="data.length == 0">
      <div style="text-align:center;height:200px">无变更记录</div>
    </template>
    <el-timeline>
      <transition-group
        mode="out-in"
        appear
        enter-active-class="animated fadeInLeft"
      >
        <el-timeline-item
          v-for="item in data"
          :key="item.AUTOID"
          :timestamp="item.SYS_ASSET_A3_60"
          color="#409EFF"
          placement="top"
        >
          <el-card style="width:480px">
            <h4>变更字段：{{ item.strSYS_ASSET_A3_20 }}</h4>
            <el-row>
              <el-col :span="12">原始值：{{ item.strSYS_ASSET_A3_30 }}</el-col>
              <el-col :span="12">变更为：{{ item.strSYS_ASSET_A3_40 }}</el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                变更方式：{{ item.strSYS_ASSET_A3_50 }}
              </el-col>
              <el-col :span="12">
                变更来源：{{ item.strSYS_ASSET_A3_70 }}
              </el-col>
            </el-row>
          </el-card>
        </el-timeline-item>
      </transition-group>
    </el-timeline>
  </div>
</template>

<script>
import { SysAssetA3 } from "@/api";
export default {
  data() {
    return {
      //页面控制
      page: {
        loading: false
      },
      //数据
      data: []
    };
  },
  //外部属性
  props: {
    formdata: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  //内部方法
  methods: {
    async initPage() {
      this.page.loading = true;
      this.data = [];
      const a3data = await SysAssetA3.get(this.formdata.ASSET_A1_AUTOID);
      a3data.forEach((item, index) => {
        setTimeout(() => {
          this.data.push(item);
        }, 200 * index);
      });
      this.$nextTick(() => {
        this.page.loading = false;
      });
    }
  },
  //组件
  components: {},
  //初始化 异步加async await
  mounted() {
    this.initPage();
  },
  //计算属性
  computed: {},
  //监视
  watch: {
    formdata() {
      this.initPage();
    }
  }
};
</script>

<style lang="scss" scoped>
@import "@/style/base.scss";
</style>
